package com.csdj.x315springboot.job;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Calendar;

@Component
public class JobTest {




    @Scheduled(fixedDelay = 3000)
    public void job(){
        //日历
        Calendar cal = Calendar.getInstance();
        //计算五天之后
//        cal.add(Calendar.DAY_OF_YEAR,5);
//        分钟数
        int min = cal.get(Calendar.MINUTE);
        //小时数
        int hour = cal.get(Calendar.HOUR_OF_DAY);
        switch (min){
            case 0:
                if(hour>12)break;
                //上午上课
                break;
            case 20:
                if(hour<12)break;
                //下午下课
                break;
            case 30:
                if(hour<12)break;
                //下午上课
                break;
            case 50:
                if(hour>12)break;
                //上午下课
                break;
        }
    }
}
